<?php
include_once('../includes/db.php');
include_once('../includes/class.krumo.php');
include_once '../includes/constants.php';

$db = new db();
$mis_ads = $db->dame_query("select publicidad.*, usuario.login as 'usuario' from publicidad inner join usuario on usuario.id = publicidad.usuario_id");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <meta http-equiv="Content-language" content="en" />
        <title> indice de anuncios :: CCIVenezuela.com </title>
        <link href="../css/style.css" rel="stylesheet" type="text/css" />
        <!--[if lte IE 7]>
        <link href="../css/patches/patch_my_layout.css" rel="stylesheet" type="text/css" />
        <![endif]-->
    </head>
    <body>
        <div id="header">
            <?php include_once SERVER_ROOT . '/template/header.php'; ?>
        </div>
        <div id="content">
            <div>
                <div class="floatbox">
                    <h1 class="titulo">Publicidad</h1>
                    <?php if (count($mis_ads['data']) > 0): ?>
                    <table class="full" width="100%">
                            <thead>
                                <tr>
                                    <th> id</th>
                                    <th> Titulo</th>
                                    <th> Url Destino</th>
                                    <th> Impresiones</th>
                                    <th> Clicks</th>
                                    <th> Usuario</th>
                                    <th> Acción</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php foreach ($mis_ads['data'] as $registro):?>
                                <tr>
                                    <td><?php echo $registro['id']; ?> </td>
                                    <td> <?php echo $registro['nombre']; ?> </td>
                                    <td><?php echo $registro['url']; ?></td>
                                    <td></td>
                                    <td></td>
                                    <td><?php echo $registro['usuario']; ?></td>
                                    <td><a href="">Editar</a> </td>
                                    <td><a href=""> Borrar</a></td>
                                </tr>
                                <?php endforeach; ?>
                            </tbody>
                        </table>
                    <?php endif; ?>
                    </div>
                <div>
                    <a href="registrar.php">Insertar nuevo registro</a>
                </div>
                </div>
            </div>
            <div id="footer">
            <?php include SERVER_ROOT . '/template/footer.php'; ?>
        </div>
    </body>
</html>